class CustomSurveys::Sixteen
  
  @@expls = {
    "A" => {
      "low" => {
        "解释" => "乐群性：缄默 孤独 冷漠",
        "技术名称" => "分裂感情",
        "一般名称" => "含蓄",
        "特征描述" => "通常表现为执拗，对人冷漠，落落寡和，吹毛求疵，宁愿独自工作，对事不对人，不轻易放弃己见，为人工作的标准很高，严谨而不苟且"
      },
      "high" => {
        "解释" => "乐群性：外向，热情，乐群",
        "技术名称" => "环性情感，或高情感",
        "一般名称" => "开朗",
        "特征描述" => "通常和蔼可亲，与人相处，合作与适应能力强；喜欢和别人共同工作，愿意参加或组织各种社团活动，不斤斤计较，容易接受别人的批评；个萍水相逢时也可一见如故"
      }
    },
    "B" => {
      "low" => {
        "解释" => "聪慧性：思想迟钝，常识浅薄，抽象思维能力弱",
        "技术名称" => "低3",
        "一般名称" => "智能较低",
        "特征描述" => "通常理解力不强，不能举一反三"
      },
      "high" => {
        "解释" => "聪慧性：聪明，富有才能，善于抽象思维",
        "技术名称" => "高8",
        "一般名称" => "智能较好",
        "特征描述" => "通常学习能力强，思维敏捷，正确"
      }
    },
    "C" => {
      "low" => {
        "解释" => "稳定性：情绪激动，容易产生烦恼",
        "技术名称" => "低自我力量",
        "一般名称" => "情感影响",
        "特征描述" => "低者通常不容易应付生活上遇到的阻挠和挫折，容易受环境支配而心神动摇，不能面对现实，常常会急躁不安，身心疲乏，甚至失眠，噩梦，恐惧等"
      },
      "high" => {
        "解释" => "稳定性：情绪稳定而成熟，能面对现实",
        "技术名称" => "高自我力量",
        "一般名称" => "情感稳定",
        "特征描述" => "通常能以沉着的态度应付现实中各种问题；行动充满魄力；能振作勇气，有团结的精神；有时也可能由于不能彻底解决许多生活能题而不得不强自宽解"
      }
    },
    "E" => {
      "low" => {
        "解释" => "持强性：谦虚，顺从，通融，恭顺",
        "技术名称" => "顺从性",
        "一般名称" => "谦虚",
        "特征描述" => "通常行为温顺，迎合别人的意思；也可能即使处在十全十美的境地，也有事事不如意之感"
      },
      "high" => {
        "解释" => "持强性：好强固执，独立积极",
        "技术名称" => "支配性",
        "一般名称" => "主观武断",
        "特征描述" => "通常自高自大，自以为是，可能非常武断，时常驾驭不及他（她）的人，对抗有权势者"
      }
    },
    "F"=>{
      "low"=>{
        "解释" => "兴奋性：严肃、审慎、冷静、寡言",
        "技术名称" => "平静",
        "一般名称" => "严肃",
        "特征描述" => "通常行动拘谨，内省而不轻发言，较消极、阴郁；有时可能过分深思熟虑，又近乎骄傲自满；在工作上常常是以为认真而可靠的工作人员"
         },
      "high"=>{
        "解释" => "兴奋性：轻松兴奋,随遇而安",
        "技术名称" => "澎湃激荡",
        "一般名称" => "无忧无虑",
        "特征描述" => "通常活泼、愉快、健谈，对人对事热心而富有情感，但是有时候也可能过分冲动，以致行为变化莫测"
       }
     },
    "G"=>{
       "low"=>{
        "解释" => "有恒性：苟且敷衍，缺乏奉公守法精神",
        "技术名称" => "低超我",
        "一般名称" => "自私自利",
        "特征描述" => "通常缺乏运大的目标和理想，缺乏责任感甚至有时候会不则手段地达到目的"
         },
       "high"=>{
        "解释" => "有恒性：有恒责任，做事尽责",
        "技术名称" => "高超我",
        "一般名称" => "有良心",
        "特征描述" => "通常心细周到，有始有终，是非善恶是他的行为指南，所结交的朋友多系努力苦干的人，不十分喜欢诙谐有趣的场合"
        }
     },
    "H"=>{
      "low"=>{
       "解释" => "敢为性：畏怯退缩，缺乏信心",
        "技术名称" => "威胁反应性",
        "一般名称" => "胆小",
        "特征描述" => "通常在人中羞怯，有不自然的表现，有强烈的自卑感；拙于发言，更不愿和陌生人交谈；凡事采取观望态度；有时由于过分的自我意识而忽视了对社会环境中的重要事物的认识"
         },
      "high"=>{
        "解释" => "敢为性：冒险敢为，少有顾忌",
        "技术名称" => "副交感免疫性",
        "一般名称" => "冒险",
        "特征描述" => "通常不掩饰，不畏缩，有敢做敢为的精神，有能经历艰辛而保持毅力；有时可能粗心大一，忽视细节；有可能无聊多事，喜欢向异性献殷勤"
        }
     },
    "I"=>{
       "low"=>{
       "解释" => "敏感性：理智，着重现实，自持其力",
        "技术名称" => "极度现实性",
        "一般名称" => "硬心肠",
        "特征描述" => "通常客观、坚持、独立的态度处理当前的问题；并不重视文化修养，以及一些主观和感情之事；可能过分骄傲冷酷无情"
         },
       "high"=>{
        "解释" => "敏感性：有恒责任，做事尽责",
        "技术名称" => "娇生性情绪过敏",
        "一般名称" => "软心肠",
        "特征描述" => "通常心肠软，易受感动，较女性化；爱好艺术，富于幻想；有时过分不务实际，缺乏内性和恒心；不喜欢接近粗鲁的人和作笨重的工作；在团队中，由于常常有这不是己的看法和行为而降低团队的工作效率"
        }
     },
     "L" => {
      "low" => {
        "解释" => "怀疑性：依赖随和，容易与人相处",
        "技术名称" => "放松",
        "一般名称" => "信任别人",
        "特征描述" => "通常无猜忌，不与人竞争；顺应合作，善于体贴人"
      },
      "high" => {
        "解释" => "怀疑性：怀疑、刚愎、固执己见",
        "技术名称" => "投射紧张",
        "一般名称" => "多疑",
        "特征描述" => "通常多疑心，不信任别人，与人相处常斤斤计较，不顾别人利益"
      }
    },
"M" => {
      "low" => {
        "解释" => "幻想性：现实、合于成规，力求妥善处理",
        "技术名称" => "实际性",
        "一般名称" => "实际",
        "特征描述" => "通常先要斟酌现实条件而后决定取舍，不鲁莽从事，在关键时刻也能保持镇静，有时可能过分重视现实，为人索然寡趣"
      },
      "high" => {
        "解释" => "幻想性：幻想、狂放仍性",
        "技术名称" => "我问或自向性",
        "一般名称" => "空想",
        "特征描述" => "通常忽视细节，只以本身动机、当时的兴趣等主观因素为行为的出发点，可能富有创造力，有时也过分不务实际，近乎冲动，因而容易被人误解"
      }
    },

  "N" => {
      "low" => {
        "解释" => "世故性：坦白、直率、天真",
        "技术名称" => "朴实性",
        "一般名称" => "直率",
        "特征描述" => "通常思想简单，感情用事；与人无争，心满意足；但有时显得幼稚，粗鲁笨拙，似乎缺乏教养"
      },
      "high" => {
        "解释" => "世故性：精明能干，世故",
        "技术名称" => "机灵性",
        "一般名称" => "伶俐",
        "特征描述" => "通常处事老练，行为得体；能冷静分析一切，但近乎狡猾；对一切事物的看法是理智的、客观的，甚至有时是刻薄的"
      }
    },

    "O" => {
      "low" => {
        "解释" => "忧虑性：安详沉着，有自信力",
        "技术名称" => "信念把握",
        "一般名称" => "安静",
        "特征描述" => "通常有自信力，不易动摇，信任自己有应付问题的能力；有安全感，能运用自如；有时因缺乏同情而引起别人的反感"
      },
      "high" => {
        "解释" => "忧虑性：忧虑抑郁、烦恼自扰",
        "技术名称" => "易于内疚",
        "一般名称" => "忧惧",
        "特征描述" => "高者通常觉得世道艰辛，人生不如意，甚至沮丧悲观；时有患得患失之感；自觉不如人，缺乏和人接近的勇气"
      }
    },

    "Q1" => {
      "low" => {
        "解释" => "实验性：保守、尊重传统观念和标准",
        "技术名称" => "保守性",
        "一般名称" => "保守",
        "特征描述" => "低者通常无条件地接受社会中许多相沿已久的、有权威性的见解，不愿尝试探新，常常激烈地反对新思想以及一切新的变革，墨守成规"
      },
      "high" => {
        "解释" => "实验性：自由和激进，不拘泥于现实",
        "技术名称" => "激进性",
        "一般名称" => "试探性",
        "特征描述" => "高者通常通常喜欢考验一切现有的理论和事实，而予新的评价，不轻易判断是非，愿意了解较先进的思想与行为；可能广见多闻，愿意充实自己的生活经验"
      }
    },

    "Q2" => {
      "low" => {
        "解释" => "独立性：依赖、随群、附和",
        "技术名称" => "团体依附",
        "一般名称" => "依赖集体",
        "特征描述" => "低者通常愿意与人共同工作，而不愿独立孤行；常常放弃个人主见，附和众议，已取得别人的好感；需要团体的支持以维持其自信心，而不是真正的乐群者"
      },
      "high" => {
        "解释" => "独立性：自立自强、当机立断",
        "技术名称" => "自给自足",
        "一般名称" => "自恃",
        "特征描述" => "高者通常能够自作主张，独立完成自己的工作计划，不依赖他人，也不收社会舆论的约束；同样，业务以控制和支配别人，不嫌恶人，但也不需要别人的好感"
      }
    },
     "Q3"=>{
       "low"=>{
        "解释" => "自律性：矛盾冲突，不顾大体",
        "技术名称" => "低整合性",
        "一般名称" => "无原则",
        "特征描述" => "低分者通常不能可克制自己，更不愿考虑别人的需要，充满矛盾，却无解决"
         },
        "high"=>{
        "解释" => "自律性：知己知彼，自律谨慎",
        "技术名称" => "高自我概念",
        "一般名称" => "克制",
        "特征描述" => "高分者通常言行一致，能够合理支配自己的感情行为，为人处事能保持自尊心，赢得别人的重视，有时却太固执成见"
        }
     },

     "Q4"=>{
       "low"=>{
       "解释" => "紧张性：心平气和，闲散宁静",
        "技术名称" => "低能量紧张",
        "一般名称" => "松懈",
        "特征描述" => "低分者通常知足常乐，保持内心的平衡，也可能过分疏懒，缺乏进取心"
         },
        "high"=>{
          "解释" => "紧张性：紧张困扰，激动挣扎",
          "技术名称" => "能量紧张",
          "一般名称" => "紧张",
          "特征描述" => "高分者通常缺乏耐心，心神不安，过渡兴奋，市场感觉疲乏，有无法彻底摆脱以求宁静，在集体中，对人对事缺乏自信心，每日战战兢兢生活不能控制自己"
        }
     }
  }

  @@expls2 = [
    {
      "short" => "X1",
      "name" => "适应与焦虑型",
      "formula" => "((38.0 + 2*(L) + 3*(O) + 4*(Q4)) - (2*(C) + 2*(H) + 2*(Q2)))/10",
      "avg" => 7.7,
      "high" => "不一定有神经症，因为他可能是是情境性的。但也可能有一些调节不良的情况。即对生活上所要求的和自己意欲达成的事情感到不满意。高度的焦虑可能会使工作受到破坏和影响身体健康。",
      "low" => "生活适应顺利，通常感到心满意足，能做到所期望的以及自己认为重要的事情。如分数极低，则有可能作困难的工作缺乏毅力，有事时知难而退，不肯奋斗努力的倾向。"
    },
    {
      "short" => "X2",
      "name" => "内向与外向型",
      "formula" => "((2*A + 3*E + 4*F + 5*H) - (2*Q2 + 11))/10",
      "avg" => 14.5,
      "high" => "外倾，开朗，善于交际，不受拘束，有利于从事贸易工作。",
      "low" => "内倾，趋向胆小，自足，在与别人的接触中采取克制态度，有利于从事精细工作。这种类型无所谓利弊，主要取决于那种情况下采取这种态度。"
    },
    {
      "short" => "X3",
      "name" => "感情用事与安详机警型",
      "formula" => "((77+2*C+2*E+2*F + 2*N) - (4*A+6*I+2*M))/10",
      "avg" => 4.9,
      "high" => "富有事业性，果断，刚毅，有进去精神，精力充沛，行动迅速，但常还是生活上的细节，只对明显的食物注意，有时会考虑不周，不计后果，贸然行事。",
      "low" => "情感丰富而感到困扰不安，它可能是缺乏信息，颓丧的类型，对生活中的细节较为含蓄敏感，性格温和，讲究生活艺术，采取行动前再三思考，顾虑太多。"
    },
    {
      "short" => "X4",
      "name" => "怯懦于与果断型",
      "formula" => "((4*E + 3*M + 4*Q1 + 4*Q2) - (3*A + 2*G))/10",
      "avg" => 12.1,
      "high" => "果断，独立，露锋芒，有气魄，有攻击型的倾向，通常会主动地寻找可以施展这种行为的环境或机会，以充分表现自己的独创能力，并从中获取利益。",
      "low" => "依赖别人，春节，个性被动，受人驱使而不能独立，对支持他的人 在行动上常适应其需求，为获取别人的欢心会事事迁就。"
    },
    {
      "short" => "Y1",
      "name" => "心里健康因素",
      "formula" => "C + F + 11 -O + 11 - Q4",
      "avg" => 22,
      "high" => "心理健康指数较高，情绪不稳定的程度较低",
      "low" => "情绪不稳定的程度颇为显著"
    },
    {
      "short" => "Y2",
      "name" => "专业有成就者的人格因素",
      "formula" => "Q3*2 + G*2 + C*2 + E + N + Q2 + Q1",
      "avg" => 109,
      "high" => "本次级因素意指人格中的某些因素可能对将来的专业成就所具有的影响，它并不代表将来装也成就所达到的水平。该测试对象的人格特征使其在特定专业领域成功几率更大",
      "low" => "本次级因素意指人格中的某些因素可能对将来的专业成就所具有的影响，它并不代表将来装也成就所达到的水平。该测试对象的人格特征使其在特定专业领域成功几率更大"
    },
    {
      "short" => "Y3",
      "name" => "创造力强者的人格因素",
      "formula" => "(11 - A)*2 + B*2 + E + (11-F)*2 + H + I*2 + M + (11-N) + Q1 + Q2*2",
      "avg" => 11.4,
      "high" => "在强调创造力的领域，应有其成就",
      "low" => "不一定适合在强调创造力的领域发展"
    },
    {
      "short" => "Y4",
      "name" => "在新环境中有成长能力的人格因素",
      "formula" => "B + G + Q3 + 11 - F",
      "avg" => 31,
      "high" => "从事专业训练成功的可能性较大",
      "low" => "从事专业训练成功的可能性较小"
    }
  ]

  @@norm_male = {
    "A" => {
      :map => [[0, 2, 1], [3, 4, 2], [5, 6, 3], [7, 8, 4], [9, 10, 5],
        [11, 12, 6],[13,14,7],[15,15,8],[16,17,9],[18,20,10]],
      :x => 10.02,
      :s => 3.27
    },
    "B" => {
      :map => [[0, 4, 1], [5, 5, 2], [6, 6, 3], [7, 7, 4], [8, 8, 5],
        [9, 9, 6],[10,10,7],[11,11,8],[12,12,9],[13,13,10]],
      :x => 8.65,
      :s => 2.61
    },
    "C" => {
      :map => [[0, 6, 1], [7, 8, 2], [9, 10, 3], [11, 12, 4], [13, 14, 5],
        [15, 17, 6],[18,19,7],[20,20,8],[21,22,9],[23,26,10]],
      :x => 15.00,
      :s => 3.95
    },
    "E" => {
      :map => [[0, 5, 1], [6, 7, 2], [8, 9, 3], [10, 11, 4], [12, 13, 5],
        [14, 16, 6],[17,18,7],[19,20,8],[21,22,9],[23,26,10]],
      :x => 12.77,
      :s => 3.60
    },
    "F" => {
      :map => [[0, 3, 1], [4, 6, 2], [7, 8, 3], [9, 11, 4], [12, 13, 5],
        [14, 16, 6],[17,19,7],[20,21,8],[22,23,9],[24,26,10]],
      :x => 12.39,
      :s => 4.40
    },
    "G" => {
      :map => [[0, 4, 1], [5, 6, 2], [7, 8, 3], [9, 10, 4], [11, 12, 5],
        [13, 14, 6],[15,16,7],[17,17,8],[18,19,9],[20,20,10]],
      :x => 12.63,
      :s => 3.31
    },
    "H" => {
      :map => [[0, 1, 1], [2, 3, 2], [4, 6, 3], [7, 8, 4], [9, 11, 5],
        [12, 14, 6],[15,17,7],[18,19,8],[20,21,9],[22,26,10]],
      :x => 11.07,
      :s => 4.43
    },
    "I" => {
      :map => [[0, 3, 1], [4, 4, 2], [5, 6, 3], [7, 8, 4], [9, 10, 5],
        [11, 12, 6],[13,14,7],[15,15,8],[16,17,9],[18,20,10]],
      :x => 9.65,
      :s => 2.95
    },
    "L" => {
      :map => [[0, 2, 1], [3, 3, 2], [4, 5, 3], [6, 7, 4], [8, 9, 5],
        [10, 12, 6],[13,13,7],[14,15,8],[16,17,9],[18,20,10]],
      :x => 10.95,
      :s => 3.06
    },
    "M" => {
      :map => [[0, 5, 1], [6, 7, 2], [8, 8, 3], [9, 10, 4], [11, 12, 5],
        [13, 14, 6],[15,15,7],[16,17,8],[18,18,9],[19,26,10]],
      :x => 10.89,
      :s => 3.51
    },
    "N" => {
      :map => [[0, 3, 1], [4, 4, 2], [5, 5, 3], [6, 7, 4], [8, 9, 5],
        [10, 11, 6],[12,12,7],[13,13,8],[14,14,9],[15,20,10]],
      :x => 9.66,
      :s => 2.75
    },
    "O" => {
      :map => [[0, 1, 1], [2, 2, 2], [3, 3, 3], [4, 5, 4], [6, 7, 5],
        [8, 10, 6],[11,12,7],[13,14,8],[15,16,9],[17,26,10]],
      :x => 8.53,
      :s => 3.64
    },
    "Q1" => {
      :map => [[0, 5, 1], [6, 7, 2], [8, 9, 3], [10, 10, 4], [11, 12, 5],
        [13, 14, 6],[15,15,7],[16,16,8],[17,18,9],[19,26,10]],
      :x => 11.50,
      :s => 2.91
    },
    "Q2" => {
      :map => [[0, 5, 1], [6, 6, 2], [7, 8, 3], [9, 10, 4], [11, 12, 5],
        [13, 15, 6],[16,16,7],[17,18,8],[19,19,9],[20,20,10]],
      :x => 12.95,
      :s => 3.34
    },
    "Q3" => {
      :map => [[0, 4, 1], [5, 5, 2], [6, 7, 3], [8, 9, 4], [10, 11, 5],
        [12, 13, 6],[14,15,7],[16,17,8],[18,18,9],[19,20,10]],
      :x => 12.16,
      :s => 3.58
    },
    "Q4" => {
      :map => [[0, 2, 1], [3, 4, 2], [5, 6, 3], [7, 8, 4], [9, 10, 5],
        [11, 13, 6],[14,15,7],[16,17,8],[18,19,9],[20,26,10]],
      :x => 10.78,
      :s => 4.01
    }    
  }

  @@norm_famale = {
    "A" => {
      :map => [[0,2,1],[3,4,2],[5,6,3],[7,8,4],[9,10,5],[11,12,6],[13,14,7],[15,16,8],[17,17,9],[18,20,10]],
      :x => 10.9,
      :s => 3.23
    },
    "B" => {
        :map => [[0,4,1],[5,5,2],[6,6,3],[7,7,4],[8,8,5],[9,9,6],[10,10,7],[11,11,8],[12,12,9],[13,13,10]],
        :x => 8.9 ,
        :s => 2.14
      },
    "C" => {
        :map => [[0,5,1],[6,7,2],[8,9,3],[10,11,4],[12,13,5],[14,16,6],[17,18,7],[19,19,8],[20,21,9],[22,26,10]],
        :x => 13.75,
        :s => 3.96
      },
    "E" => {
        :map => [[0,5,1],[6,7,2],[8,9,3],[10,11,4],[12,13,5],[14,15,6],[16,17,7],[18,19,8],[20,21,9],[22,26,10]],
        :x => 11.7 ,
        :s => 3.58
      },
    "F" => {
        :map => [[0,4,1],[5,6,2],[7,9,3],[10,11,4],[12,14,5],[15,17,6],[18,19,7],[20,21,8],[22,24,9],[25,26,10]],
        :x => 12.84,
        :s => 4.79
      },
    "G" => {
        :map => [[0,4,1],[5,5,2],[6,7,3],[8,9,4],[10,11,5],[12,13,6],[14,15,7],[16,16,8],[17,17,9],[18,20,10]],
        :x => 12.46 ,
        :s => 3.14
      },
    "H" => {
        :map => [[0,1,1],[2,3,2],[4,6,3],[7,8,4],[9,11,5],[12,14,6],[15,16,7],[17,18,8],[19,20,9],[21,26,10]],
        :x => 10.47 ,
        :s => 4.46
      },
    "I" => {
        :map => [[0,4,1],[5,5,2],[6,7,3],[8,9,4],[10,11,5],[12,13,6],[14,14,7],[15,16,8],[17,17,9],[18,20,10]],
        :x => 10.68 ,
        :s => 2.91
      },
    "L" => {
        :map => [[0,3,1],[4,4,2],[5,6,3],[7,8,4],[9,10,5],[11,12,6],[13,13,7],[14,15,8],[16,16,9],[17,20,10]],
        :x => 10.23 ,
        :s => 3.24
      },
     "M" => {
        :map => [[0,6,1],[7,8,2],[9,9,3],[10,11,4],[12,13,5],[14,15,6],[16,17,7],[18,18,8],[19,19,9],[20,26,10]],
        :x => 12.23,
        :s => 3.36
      },
    "N" => {
        :map => [[0,3,1],[4,5,2],[6,6,3],[7,8,4],[9,10,5],[11,11,6],[12,12,7],[13,14,8],[15,15,9],[16,20,10]],
        :x => 9.94 ,
        :s => 2.95
      },
    "O" => {
        :map => [[0,1,1],[2,2,2],[3,4,3],[5,6,4],[7,9,5],[10,11,6],[12,14,7],[15,16,8],[17,18,9],[19,26,10]],
        :x => 9.99 ,
        :s => 3.84
      },
    "Q1" => {
        :map => [[0,6,1],[7,7,2],[8,9,3],[10,10,4],[11,12,5],[13,14,6],[15,15,7],[16,16,8],[17,18,9],[19,20,10]],
        :x => 11.19,
        :s => 2.90
      },
    "Q2" => {
        :map => [[0,4,1],[5,6,2],[7,8,3],[9,10,4],[11,12,5],[13,14,6],[15,16,7],[17,17,8],[18,19,9],[20,20,10]],
        :x => 11.65 ,
        :s => 3.21
      },
    "Q3" => {
        :map => [[0,4,1],[5,6,2],[7,8,3],[9,9,4],[10,12,5],[13,14,6],[15,15,7],[16,17,8],[18,18,9],[19,20,10]],
        :x => 12.24 ,
        :s => 3.76
      },
     "Q4" => {
        :map => [[0,3,1],[4,5,2],[6,7,3],[8,9,4],[10,11,5],[12,14,6],[15,16,7],[17,18,8],[19,20,9],[21,26,10]],
        :x => 11.75,
        :s => 4.21
      }
  }

  
  #根据分数得到解释
  def self.expls(dimen_results, gender)
    expls = {}
    dimens = {}
    dimens2 = []

    dimen_results.each do |d|
      dimen = Dimen.find(d.dimen_id)
      #一元维度结果
      if @@expls[dimen.name]
        if gender == "男"
          norm = @@norm_male
        else
          norm = @@norm_famale
        end
        dimen_map = norm[dimen.name]
        arr = dimen_map[:map].find {|m| m[0] <= d.total.to_f and d.total.to_f <= m[1]}
        dimen_value = arr[2]

        if dimen_value >= 7
          expl = @@expls[dimen.name]["high"]
        elsif dimen_value <= 4
          expl = @@expls[dimen.name]["low"]
        else
          expl = "no"
        end

        dimens[dimen.name] = {:value => d.total, :t => dimen_value, :expl => expl}
      end
    end

    #二元维度结果
    @@expls2.each do |e|
      formula = e["formula"].gsub(/A|B|C|E|F|G|H|I|L|M|N|O|Q1|Q2|Q3|Q4/) { |s| "dimens['#{s}'][:t]" }
      #formula = e["formula"]
      value = eval(formula).to_f
      expl = value >= e["avg"] ? e["high"] : e["low"]
      dimens2.push({:short => e["short"], :name => e["name"], :value => value, :expl => expl})
    end

    expls[:dimens] = dimens
    expls[:json] = get_json(dimens)
    expls[:dimens2] = dimens2

    return expls
  end

  def self.get_json(dimens)
    json = "[{label: '', data: [null, "
    json_end = "null]
              },

              {
                  points: {show: false},
                  lines: {show: false},
                  data: [[-6, 1], [-5, 1], [-4, 1],[-3, 1], [-2, 1], [-1, 1], [0, 1], [1, 1],
                         [2, 1], [3, 1], [4, 1],[5, 1], [6, 1]
                  
                  ]
              }

              ]"

    #json += "[1, " + sprintf("%8.0f", report[:dimen_results][@@dimens[:L]]) + "],"
    m = -5.5

    i = 17
    json += "[#{dimens["A"][:t] + m}, #{i -= 1}],"
    json += "[#{dimens["B"][:t] + m}, #{i -= 1}],"
    json += "[#{dimens["C"][:t] + m}, #{i -= 1}],"
    json += "[#{dimens["E"][:t] + m}, #{i -= 1}],"
    json += "[#{dimens["F"][:t] + m}, #{i -= 1}],"
    json += "[#{dimens["G"][:t] + m}, #{i -= 1}],"
    json += "[#{dimens["H"][:t] + m}, #{i -= 1}],"
    json += "[#{dimens["I"][:t] + m}, #{i -= 1}],"
    json += "[#{dimens["L"][:t] + m}, #{i -= 1}],"
    json += "[#{dimens["M"][:t] + m}, #{i -= 1}],"
    json += "[#{dimens["N"][:t] + m}, #{i -= 1}],"
    json += "[#{dimens["O"][:t] + m}, #{i -= 1}],"
    json += "[#{dimens["Q1"][:t] + m}, #{i -= 1}],"
    json += "[#{dimens["Q2"][:t] + m}, #{i -= 1}],"
    json += "[#{dimens["Q3"][:t] + m}, #{i -= 1}],"
    json += "[#{dimens["Q4"][:t] + m}, #{i -= 1}],"

    json += json_end

    json
  end
end